package Week6.J0520;
// 堆
import java.util.PriorityQueue;
import java.util.Scanner;

public class 小红的口罩_xv {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt(), k = scanner.nextInt();
        PriorityQueue<Integer> queue = new PriorityQueue<>();
        int sum = 0, count = 0;
        for (int i = 0; i < n; i++) {
            queue.add(scanner.nextInt());
        }

        while (true) {
            int t = queue.poll();
                sum += t;
                count++;
            queue.add(t * 2);
            if (sum > k) {
                System.out.println(count - 1);
                break;
            }
        }
    }
}
